package com.qingmeng.apiclientsdk.exception;

/**
 * @Author: WPF
 * @Date: 2025/01/02 17:05
 * @Version: 1.0
 * @Description: API调用异常
 */
public class ApiException extends Exception{
    private static final long serialVersionUID = -4306383104749478897L;
    private int code;

    public ApiException(int code, String message) {
        super(message);
        this.code = code;
    }

    public ApiException(String message, Throwable cause) {
        super(message, cause);
    }

    public ApiException(ErrorCode errorCode) {
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
    }

    public ApiException(ErrorCode errorCode, String message) {
        super(message);
        this.code = errorCode.getCode();
    }

    public int getCode() {
        return code;
    }
}
